1 import os
2 import pickle
3
4 details_list=[]
5 l2=[]
6 G = []
7 def file_save():
8 NAME_PRO = details_list[0]
9 ADDRESS_PRO = details_list[1]
10 MOBILE_NO_PRO = details_list[2]
11 ROOM_NO_PRO = details_list[3]
12 PRICE_PRO = details_list[4]
13 f = open("hotel.dat", "ab")
14 a=save(NAME_PRO,ADDRESS_PRO,MOBILE_NO_PRO,ROOM_NO_PRO,PRICE_PRO)
15 pickle.dump(a,f,protocol=2)
16 f.close()
17 restart_program()
18
19
20 def restart_program():
21 python = sys.executable
22 os.execl(python, python, * sys.argv)
23
24
25
26
27
28
29 class save:
30 def __init__(self, NAME_PRO, ADDRESS_PRO, MOBILE_NO_PRO, ROOM_NO_PRO, PRICE_PRO):
31 self.name=NAME_PRO
32 self.address=ADDRESS_PRO
33 self.mobile_no=MOBILE_NO_PRO
34 self.room_no=ROOM_NO_PRO
35 self.price=PRICE_PRO
36 print(self.name,self.address,self.mobile_no,self.room_no,self.price)
37
38
39
40
41
42 import sys
43
44 try:
45 from Tkinter import *
46 except ImportError:
47 from tkinter import *
48
49 try:
50 import ttk
51 py3 = False
52 except ImportError:
53 import tkinter.ttk as ttk
54 py3 = True
55
56
57
58 class New_Toplevel:
59
60 def __init__(self):
61 def check_room():
62 self.rom = str(self.data.get())
63 print(self.rom)
64 print("\n")
65 if self.rom.isdigit() == True and len(self.rom) != 0:
66 self.Text1.insert(INSERT, " valid room number ""\n")
67 v = int(self.rom)
68 f = open("hotel.dat", "rb")
69 f1 = open("hote.dat", "ab")
70 n = 0
71 try:
72 while True:
73 s = pickle.load(f)
74 if s.room_no == v:
75 n = 1
76 name1 = s.name
77
78 print(" ")
79 else:
80 pickle.dump(s, f1)
81 except EOFError:
82 if n == 0:
83 self.Text1.insert(INSERT, "NO GUEST FOUND""\n")
84
85 elif n == 1:
86
87 self.Text1.insert(INSERT, "THANK YOU " + name1.upper() + " FOR VISTING US""\n")
88 pass
89 f.close()
90 f1.close()
91 os.remove("hotel.dat")
92 os.rename("hote.dat", "hotel.dat")
93
94 else:
95 self.Text1.insert(INSERT, "invalid input please input a valid ROOM NO.""\n")
96
97 root = Tk()
98 '''This class configures and populates the toplevel window.
99 top is the toplevel containing window.'''
100 _bgcolor = '#ffffff' # X11 color: 'white'
101 _fgcolor = '#000000' # X11 color: 'black'
102 _compcolor = '#ffffff' # X11 color: 'white'
103 _ana1color = '#ffffff' # X11 color: 'white'
104 _ana2color = '#ffffff' # X11 color: 'white'
105 font10 = "-family {Courier New} -size 10 -weight normal -slant" \
106 " roman -underline 0 -overstrike 0"
107 font11 = "-family {Segoe UI} -size 23 -weight bold -slant " \
108 "roman -underline 0 -overstrike 0"
109 font12 = "-family {Segoe UI} -size 24 -weight bold -slant " \
110 "roman -underline 0 -overstrike 0"
111 font9 = "-family {Segoe UI} -size 9 -weight normal -slant " \
112 "roman -underline 0 -overstrike 0"
113
114 root.geometry("1011x750")
115 root.title("Hotel Management System")
116 root.configure(background="#ffffff")
117 root.configure(highlightbackground="#ffffff")
118 root.configure(highlightcolor="black")
119
120
121
122 self.Frame1 = Frame(root)
123 self.Frame1.place(relx=0.04, rely=0.04, relheight=0.91, relwidth=0.91)
124 self.Frame1.configure(relief=GROOVE)
125 self.Frame1.configure(borderwidth="2")
126 self.Frame1.configure(relief=GROOVE)
127 self.Frame1.configure(background="#ffffff")
128 self.Frame1.configure(highlightbackground="#ffffff")
129 self.Frame1.configure(highlightcolor="black")
130 self.Frame1.configure(width=925)
131
132 self.Label1 = Label(self.Frame1)
133 self.Label1.place(relx=0.14, rely=0.12, height=46, width=442)
134 self.Label1.configure(activebackground="#ffffff")
135 self.Label1.configure(activeforeground="black")
136 self.Label1.configure(background="#ffffff")
137 self.Label1.configure(disabledforeground="#bfbfbf")
138 self.Label1.configure(font=font11)
139 self.Label1.configure(foreground="#000000")
140 self.Label1.configure(highlightbackground="#ffffff")
141 self.Label1.configure(highlightcolor="black")
142 self.Label1.configure(text='''ENTER THE ROOM NO. :''')
143
144 self.Entry1 = Entry(self.Frame1)
145 self.data=StringVar()
146 self.Entry1.place(relx=0.67, rely=0.12,height=44, relwidth=0.07)
147 self.Entry1.configure(background="white")
148 self.Entry1.configure(disabledforeground="#bfbfbf")
149 self.Entry1.configure(font=font10)
150 self.Entry1.configure(foreground="#000000")
151 self.Entry1.configure(highlightbackground="#ffffff")
152 self.Entry1.configure(highlightcolor="black")
153 self.Entry1.configure(insertbackground="black")
154 self.Entry1.configure(selectbackground="#e6e6e6")
155 self.Entry1.configure(selectforeground="black")
156 self.Entry1.configure(textvariable=self.data)
157
158
159
160
161
162
163
164 self.Text1 = Text(self.Frame1)
165 self.Text1.place(relx=0.05, rely=0.54, relheight=0.4, relwidth=0.89)
166 self.Text1.configure(background="white")
167 self.Text1.configure(font=font9)
168 self.Text1.configure(foreground="black")
169 self.Text1.configure(highlightbackground="#ffffff")
170 self.Text1.configure(highlightcolor="black")
171 self.Text1.configure(insertbackground="black")
172 self.Text1.configure(selectbackground="#e6e6e6")
173 self.Text1.configure(selectforeground="black")
174 self.Text1.configure(width=824)
175 self.Text1.configure(wrap=WORD)
176
177 self.Button1 = Button(self.Frame1)
178 self.Button1.place(relx=0.34, rely=0.28, height=93, width=286)
179 self.Button1.configure(activebackground="#ffffff")
180 self.Button1.configure(activeforeground="#000000")
181 self.Button1.configure(background="#ffffff")
182 self.Button1.configure(disabledforeground="#bfbfbf")
183 self.Button1.configure(font=font12)
184 self.Button1.configure(foreground="#000000")
185 self.Button1.configure(highlightbackground="#ffffff")
186 self.Button1.configure(highlightcolor="black")
187 self.Button1.configure(pady="0")
188 self.Button1.configure(text='''CHECK OUT''')
189 self.Button1.configure(command=check_room)
190 root.mainloop()
191
192
193
194 if __name__ == '__main__':
195 out=New_Toplevel()